/**
 *	all functions related to the 'HostMatchPage' view
**/

if (typeof Controllers === "undefined") {
	var Controllers = { }
}


Controllers.HostMatchPage = {
	
	//run this when we begin the hosting process. sets up the host page and begins the host loop
	begin: function() {
		var el = {
			player1: document.getElementById("HMPplayer1"),
			player2: document.getElementById("HMPplayer2"),
		}
		
		//show the player names
		el.player1.innerText = Main.clientInfo.user
		el.player2.innerText = '...'
		
		//begin the hosting main loop
		MatchHost.host()
	},
	
	//go back, quitting the hosting loop
	back: function() {
		API.kill()										//kill xhrs, in case we are waiting for the game to be set up
		MatchHost.hostMainLoop('stop')					//stop main loop
		Main.goTo('MatchPage')
	},
	
	beginGame: function(el) {
		if (el.className.match( /disabled/ )) {
			return
		} else {
			alert('does nothing!')
		}
	},
	
}